// 帮我生成一个表单，里面包含用户名，密码，姓名，年龄，学号，email，班级等字段，其中班级用下拉框
<template>
  <div>
    <el-form label-width="80px">
      <el-form-item label="用户名">
        <el-input v-model="form.username"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input type="password" v-model="form.pwd"></el-input>
      </el-form-item>
      <el-form-item label="确认密码">
        <el-input v-model="form.password"></el-input>
      </el-form-item>
      <el-form-item label="姓名">
        <el-input v-model="form.realName"></el-input>
      </el-form-item>
      <el-form-item label="年龄">
        <el-input type="number" v-model="form.age"></el-input>
      </el-form-item>
      <el-form-item label="学号">
        <el-input v-model="form.stuNum"></el-input>
      </el-form-item>
      <el-form-item label="班级">
        <el-select v-model="form.className" placeholder="选择班级" size="large" style="width: 240px">
        <el-option :key="1" label="23软件技术1班"  value="23软件技术1班" />
        <el-option :key="2" label="23软件技术2班" value="23软件技术2班" />
      </el-select>
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="onReg">注册</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script setup lang="ts">
import { reactive } from 'vue'
import { reg } from '../utils/request'
import { useRouter } from 'vue-router';
const router = useRouter();
const form = reactive({
  username: '',
  pwd: '',
  password: '',
  realName: '',
  age: '',
  stuNum: '',
  className: '23软件技术2班',
})

const onReg = async () => {
  const r = await reg(form)
  console.log(r);
  if (r.errno) return alert(r.message);
  else
    router.push('/login');
}


</script>



